package com.kmzx.one.project.controller;

import com.kmzx.one.project.net.BaseResult;
import com.kmzx.one.project.others.common.SystemStates;
import com.kmzx.one.project.others.dto.BannerInfo;
import com.kmzx.one.project.service.SimpleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "快美甄选_[ 轮播图_接口 ]")
@RestController
public class BannerController extends BaseController {

    @Autowired
    private SimpleService simpleService;

    @ApiOperation(value = "轮播图", notes = "获取所有轮播图",position = -1)
    @GetMapping(value = "allBanner")
    public BaseResult findAllBanner() {
        List<BannerInfo> allBanners = simpleService.findAllBanners();
        BaseResult result = new BaseResult();
        result.setData(allBanners);
        result.setCode(200).setErrCode(200)
                .setMsg("OK").setErrMsg("OK");

//        BaseResult success = BaseResult.Builder.SUCC().initSuccData(allBanners);
        return result;
    }


    @ApiOperation(value = "2.系统维护", notes = "系统维护",position = -1)
    @GetMapping(value = "system")
    public BaseResult systemStates() {
        SystemStates states = new SystemStates();
        states.setOn(true);
//        states.setOn(false);
        states.setUrl("/pages/list/list");
        BaseResult result = new BaseResult();
        result.setData(states);
        result.setCode(200).setErrCode(200)
                .setMsg("OK").setErrMsg("OK");
        return result;
    }
}
